/**
 *  文件名:GameActivity.java
 *  修改人:lihangjie
 *  创建时间:2015-9-6 上午10:34:52
 */
package com.sharemob.tinchat.modules.account;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.sharemob.tinchat.R;
import com.sharemob.tinchat.base.BaseActivity;

/**
 * 
 * <一句话功能简述>
 *
 * @author lihangjie
 * version [版本号,2015-9-6 上午10:34:52]
 * @see    [相关类/方法]
 * @since  [产品/模块版本]
 *
 */
public class GameActivity extends BaseActivity {
    final String url = "http://www.baidu.com";
    private WebView webview; 
	protected void onCreate(Bundle savedInstanceState)
	{
	        super.onCreate(savedInstanceState);
	        requestWindowFeature(Window.FEATURE_NO_TITLE);
	        
	        setContentView(R.layout.activity_game);
	        
	        this.exitView(R.id.title_back,R.anim.out_from_top,0);
	        
	        webview=(WebView)findViewById(R.id.webview_game);
	      //设置WebView属性，能够执行Javascript脚本  
	        webview.getSettings().setJavaScriptEnabled(true);
	        webview.setVerticalScrollBarEnabled(false);
	        webview.loadUrl(url);
	        webview.setWebViewClient(new GameWebViewClient()); 
	        
	}
	protected void keyEventOfListView(int position, int id) {
		// TODO Auto-generated method stub
		
	}

    //设置回退  
    //覆盖Activity类的onKeyDown(int keyCoder,KeyEvent event)方法  
    public boolean onKeyDown(int keyCode, KeyEvent event) {  
        if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) {  
            webview.goBack(); //goBack()表示返回WebView的上一页面  
            return true;  
        }  
        return false;  
    }
	//Web视图  
    private class GameWebViewClient extends WebViewClient {  
        @Override 
        public boolean shouldOverrideUrlLoading(WebView view, String url) {  
            view.loadUrl(url);  
            return true;  
        }  
    }  
}
